# -*- coding: utf-8 -*-

import scrapy

from hzw.items import HzwItem


class HzysSpider(scrapy.spiders.Spider):
    name = "hzw"
    allowed_domains = ["hzw.com.cn"]
    start_urls = [
        "http://www.hzw.com.cn/"
    ]

    def parse(self, response):
        for sel in response.xpath('//div[@class="tab-con"]/ul/li'):
            item = HzwItem()
            item['title'] = sel.xpath('a[@target="_blank"]/div[@class="pro-name"]/text()').extract()
            item['img'] = sel.xpath('a[@target="_blank"]/div[@class="pro-img-a"]/img/@src').extract()
            item['link'] = sel.xpath('a[@target="_blank"]/@href').extract()
            yield item


